<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"example.com","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="此篇为学习强化学习的个人笔记，对应书籍Reinforcement Learning An Introduction，第四章Dynamic Programming">
<meta property="og:type" content="article">
<meta property="og:title" content="4-动态规划">
<meta property="og:url" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/index.html">
<meta property="og:site_name" content="祖浩の博客">
<meta property="og:description" content="此篇为学习强化学习的个人笔记，对应书籍Reinforcement Learning An Introduction，第四章Dynamic Programming">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211029202147117.png">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211029204755990.png">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211029205815101.png">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211029205831949.png">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211029205846637.png">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211029205907632.png">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211030150520079.png">
<meta property="og:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211030153238770.png">
<meta property="article:published_time" content="2021-10-30T08:09:17.000Z">
<meta property="article:modified_time" content="2021-11-04T03:16:30.732Z">
<meta property="article:author" content="谢祖浩">
<meta property="article:tag" content="强化学习">
<meta property="article:tag" content="动态规划">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/image-20211029202147117.png">

<link rel="canonical" href="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>4-动态规划 | 祖浩の博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">祖浩の博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/10/30/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/4-%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/head.jpeg">
      <meta itemprop="name" content="谢祖浩">
      <meta itemprop="description" content="驽马十驾，功在不舍">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="祖浩の博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          4-动态规划
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-10-30 16:09:17" itemprop="dateCreated datePublished" datetime="2021-10-30T16:09:17+08:00">2021-10-30</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-11-04 11:16:30" itemprop="dateModified" datetime="2021-11-04T11:16:30+08:00">2021-11-04</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/" itemprop="url" rel="index"><span itemprop="name">强化学习</span></a>
                </span>
            </span>

          
            <div class="post-description">此篇为学习强化学习的个人笔记，对应书籍Reinforcement Learning An Introduction，第四章Dynamic Programming</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>前面两章主要介绍了如何评价一个策略的好坏。那么我们如何找到一个最优的策略呢？上一章介绍了显式求解法，但这种方法的适用范围很窄。</p>
<p>这一章介绍的方法是<font face="仿宋"><strong>动态规划</strong></font>（<span class="math inline">\(dynamic~programming\)</span>​​​​），其核心思想是使用价值函数来结构化的组织对最优策略的搜索，本章使用DP来计算第三章中定义的价值函数，DP算法就是把贝尔曼方程转化为近似逼近理想价值函数的递归更新公式。</p>
<h1 id="策略估计">策略估计</h1>
<p><font face="仿宋"><strong>策略估计</strong></font>（<span class="math inline">\(policy~evaluation\)</span>）：如何计算策略<span class="math inline">\(\pi\)</span>对应的状态价值函数<span class="math inline">\(v_{\pi}\)</span>.</p>
<p>状态价值的贝尔曼方程如下： <span class="math display">\[
v_{\pi}(s) =\sum_{a} \pi(a \mid s) \sum_{s^{\prime}, r} p\left(s^{\prime}, r \mid s, a\right)\left[r+\gamma v_{\pi}\left(s^{\prime}\right)\right]
\]</span> 想要计算就会有一个问题，每次计算中都有<span class="math inline">\(v_{\pi}(s&#39;)\)</span>​​，这是下一状态的价值，我们如何“未卜先知”，知道下一状态的价值呢？如果我们知道环境的动态特征（如：<span class="math inline">\(p(s&#39;,r|s,a),r\)</span>​），一共有<span class="math inline">\(S\)</span>​个状态，那么求取<span class="math inline">\(v_{\pi}(s)\)</span>​​就是求解一个有<span class="math inline">\(S\)</span>​个未知数的线性方程组。</p>
<p>另一个，是使用迭代法，假设所有<span class="math inline">\(v(s)\)</span>为随机值，不断使用贝尔曼公式计算每一个<span class="math inline">\(v(s)\)</span>，当迭代次数<span class="math inline">\(k \to \infty\)</span> 时，<span class="math inline">\(v_k\)</span>会收敛到<span class="math inline">\(v_{\pi}\)</span>. 这个算法被称为<font face="仿宋"><strong>迭代策略评估</strong></font>。（<font color = red>WHY: 为什么可以迭代求解？</font>）迭代的公式如下：</p>
<p><span class="math display">\[
\begin{equation}\label{Policy Evaluation}
\begin{aligned}
v_{k+1}(s) &amp; \doteq \mathbb{E}_{\pi}\left[R_{t+1}+\gamma v_{k}\left(S_{t+1}\right) \mid S_{t}=s\right] \\
&amp;=\sum \pi(a \mid s) \sum p\left(s^{\prime}, r \mid s, a\right)\left[r+\gamma v_{k}\left(s^{\prime}\right)\right]
\end{aligned}
\end{equation}
\]</span></p>
<p>迭代伪代码如下：</p>
<p><img src="image-20211029202147117.png" alt="image-20211029202147117" style="zoom:50%;" /></p>
<p>这里迭代时，涉及到新旧值的问题。第一种方法被叫做同步备份法（<strong>synchronous backups</strong>），使用两个数组来分别存储旧的价值函数<span class="math inline">\(v_{k}(s)\)</span>和新价值函数<span class="math inline">\(v_{k+1}(s)\)</span>，在对状态进行某一轮计算时，所有新价值函数值都来源于旧价值数组中的<span class="math inline">\(v_k(s)\)</span>。另一种是“就地”更新，每计算出一个价值函数的值，下次用到时直接使用新值。就地更新的方式收敛速度更快。</p>
<p>例：RL:An introduction中的例4.1</p>
<p><img src="image-20211029204755990.png" alt="image-20211029204755990" style="zoom: 25%;" /></p>
<p>这里先对所有网格的收益初始化为<span class="math inline">\(0\)</span>​​。使用同步备份法：</p>
<p><span class="math inline">\(k=1\)</span>​：对于位置1，有：<span class="math inline">\(v(s) = \frac{1}{4} \cdot 1\cdot (-1)+\frac{1}{4} \cdot 1\cdot (-1)+\frac{1}{4} \cdot 1\cdot (-1)+\frac{1}{4} \cdot 1\cdot (-1)= -1\)</span>​.​​</p>
<p>对于其他位置，都有如上计算，因此除了灰色区域价值为0外，其余位置价值为<span class="math inline">\(-1\)</span>.</p>
<p><span class="math inline">\(k=2\)</span>​：对于位置1有：<span class="math inline">\(v(s)=\frac{1}{4} \cdot 1 \cdot (-1-1)+\frac{1}{4} \cdot 1 \cdot (-1-1)+\frac{1}{4} \cdot 1 \cdot (-1-1)+\frac{1}{4} \cdot 1 \cdot (-1+0)=1.75\)</span>​​.其他位置同理计算于是有以下过程：</p>
<div data-align="center">
<p><img src="image-20211029205815101.png" height="100px" alt="图片说明" > <img src="image-20211029205831949.png" height="100px" alt="图片说明" > <img src="image-20211029205846637.png" height="100px" alt="图片说明" > <img src="image-20211029205907632.png" height="100px" alt="图片说明" ></p>
</div>
<h1 id="策略改进">策略改进</h1>
<p>通过不断迭代计算，我们可以得到每个状态的价值（评估），那么如何根据所得价值来修改策略<span class="math inline">\(\pi\)</span>来最大化收益呢？</p>
<p>所谓策略可以理解为在什么状态选择何种动作，就是选择动作的概率。那么自然的，可以使用贪心策略。在使用迭代计算完所有状态的价值后，在所有状态和动作中，选择所有价值最高的动作作为策略；可以设此策略为<span class="math inline">\(\pi &#39;\)</span>​： <span class="math display">\[
\begin{aligned}
\pi^{\prime}(s) &amp; \doteq \underset{a}{\arg \max } q_{\pi}(s, a) \\
&amp;=\underset{a}{\arg \max } \mathbb{E}\left[R_{t+1}+\gamma v_{\pi}\left(S_{t+1}\right) \mid S_{t}=s, A_{t}=a\right] \\
&amp;=\underset{a}{\arg \max } \sum_{s^{\prime}, r} p\left(s^{\prime}, r \mid s, a\right)\left[r+\gamma v_{\pi}\left(s^{\prime}\right)\right]
\end{aligned}
\]</span></p>
<h1 id="策略迭代">策略迭代</h1>
<p>上面，我们知道了如何通过迭代计算状态价值（评估），如何改进策略。可以说，改进策略是基于迭代计算状态价值的，因为更新需要每个状态的价值。如何合理安排两项工作的顺序，使得算法的收敛速度上升，得到更好的结果呢？这种寻找最优策略的方法被称为策略改进。下面给出伪代码：</p>
<p><img src="image-20211030150520079.png" alt="image-20211030150520079" style="zoom: 50%;" /></p>
<p>这个算法分为三个部分，第一是初始化，对状态价值和策略随机赋值。</p>
<p>第二是策略评估，使用迭代法获得每个状态的价值，直到收敛结束。</p>
<p>第三是策略改进，根据当前状态价值，使用贪心算法获得最优策略；然后再次进行第二部分，更新当前的状态价值，直到找到的策略不变为止。</p>
<h1 id="价值迭代">价值迭代</h1>
<p>前面提到的迭代策略有个缺点，就是每次变更策略后都要进行策略评估，等待其收敛是一个漫长复杂的过程。或许我们可以提前截断策略评估过程。</p>
<p>一种特殊的办法：只进行一次评估，这被称为价值迭代。可以将此表示为结合了策略改进和阶段策略评估的简单更新公式。价值迭代更新公式如下： <span class="math display">\[
\begin{equation}\label{value iteration}
\begin{aligned}
v_{k+1}(s) &amp; \doteq \max _{a} \mathbb{E}\left[R_{t+1}+\gamma v_{k}\left(S_{t+1}\right) \mid S_{t}=s, A_{t}=a\right] \\
&amp;=\max _{a} \sum p\left(s^{\prime}, r \mid s, a\right)\left[r+\gamma v_{k}\left(s^{\prime}\right)\right]
\end{aligned}
\end{equation}
\]</span> 对比价值迭代更新公式<span class="math inline">\(\eqref{value iteration}\)</span>和策略评估公式<span class="math inline">\(\eqref{Policy Evaluation}\)</span>，可以发现两个几乎一样。只是策略评估使用加权平均作为更新值，价值迭代使用最大值作为更新值。伪代码如下：</p>
<p><img src="image-20211030153238770.png" alt="image-20211030153238770" style="zoom:30%;" /></p>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/" rel="tag"># 强化学习</a>
              <a href="/tags/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92/" rel="tag"># 动态规划</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/10/25/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/3-%E6%9C%89%E9%99%90%E9%A9%AC%E5%B0%94%E5%8F%AF%E5%A4%AB%E5%86%B3%E7%AD%96%E8%BF%87%E7%A8%8B/" rel="prev" title="3-有限马尔可夫决策过程">
      <i class="fa fa-chevron-left"></i> 3-有限马尔可夫决策过程
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/11/04/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/5-%E8%92%99%E7%89%B9%E5%8D%A1%E6%B4%9B%E6%96%B9%E6%B3%95/" rel="next" title="5-蒙特卡洛方法">
      5-蒙特卡洛方法 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%AD%96%E7%95%A5%E4%BC%B0%E8%AE%A1"><span class="nav-number">1.</span> <span class="nav-text">策略估计</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%AD%96%E7%95%A5%E6%94%B9%E8%BF%9B"><span class="nav-number">2.</span> <span class="nav-text">策略改进</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%AD%96%E7%95%A5%E8%BF%AD%E4%BB%A3"><span class="nav-number">3.</span> <span class="nav-text">策略迭代</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BB%B7%E5%80%BC%E8%BF%AD%E4%BB%A3"><span class="nav-number">4.</span> <span class="nav-text">价值迭代</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="谢祖浩"
      src="/images/head.jpeg">
  <p class="site-author-name" itemprop="name">谢祖浩</p>
  <div class="site-description" itemprop="description">驽马十驾，功在不舍</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">9</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">13</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">谢祖浩</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  
      

<script>
  if (typeof MathJax === 'undefined') {
    window.MathJax = {
      loader: {
        source: {
          '[tex]/amsCd': '[tex]/amscd',
          '[tex]/AMScd': '[tex]/amscd'
        }
      },
      tex: {
        inlineMath: {'[+]': [['$', '$']]},
        tags: 'ams'
      },
      options: {
        renderActions: {
          findScript: [10, doc => {
            document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
              const display = !!node.type.match(/; *mode=display/);
              const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
              const text = document.createTextNode('');
              node.parentNode.replaceChild(text, node);
              math.start = {node: text, delim: '', n: 0};
              math.end = {node: text, delim: '', n: 0};
              doc.math.push(math);
            });
          }, '', false],
          insertedScript: [200, () => {
            document.querySelectorAll('mjx-container').forEach(node => {
              let target = node.parentNode;
              if (target.nodeName.toLowerCase() === 'li') {
                target.parentNode.classList.add('has-jax');
              }
            });
          }, '', false]
        }
      }
    };
    (function () {
      var script = document.createElement('script');
      script.src = '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
      script.defer = true;
      document.head.appendChild(script);
    })();
  } else {
    MathJax.startup.document.state(0);
    MathJax.texReset();
    MathJax.typeset();
  }
</script>

    

  

</body>
</html>
